import cv2
image=cv2.imread()
sobelx = cv2.Sobel(image,cv2.CV_64F,1,0)
sobely = cv2.Sobel(image,cv2.CV_64F,0,1)
grad_x = cv2.convertScaleAbs(sobelx)
grad_y = cv2.convertScaleAbs(sobely)
sobelxy = cv2.addWeighted(grad_x,0.5,grad_y,0.5,0)
scharrx = cv2.Scharr(image,cv2.CV_64F,1,0)
scharry = cv2.Scharr(image,cv2.CV_64F,0,1)
gradx = cv2.convertScaleAbs(scharrx)
grady = cv2.convertScaleAbs(scharry)
scharrxy = cv2.addWeighted(gradx,0.5,grady,0.5,0)
cv2.imshow('Input',image)
cv2.imshow('Sobel',sobelxy)
cv2.imshow('scharr',scharrxy)
cv2.waitKey()
cv2.destroyAllWindows()